updating oE ensure_in_range

ensure_in_range

include math.e 
namespace math 
public function ensure_in_range(object item, sequence range_limits) 

ensures that the item is in a range of values supplied by inclusive range_limits.

Parameters:
  1. item : The object to test for.
  2. range_limits : A sequence of two or more elements. The first is assumed to be the smallest value and the last is assumed to be the highest value.
Returns:

A object, If item is lower than the first item in the range_limits it returns the first item. If item is higher than the last element in the range_limits it returns the last item. Otherwise it returns item.

Example 1:
object valid_data = ensure_in_range(user_data, {2, 75}) 
if not equal(valid_data, user_data) then 
    errmsg("Invalid input supplied. Using %d instead.", valid_data) 
end if 
procA(valid_data) 
Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu